using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class ARC_SO_BillHEADERMap : EntityTypeConfiguration<ARC_SO_BillHEADER>
    {
        public ARC_SO_BillHEADERMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Number, t.Document_type, t.Bill_type, t.Patient_type, t.Voucher, t.DATE, t.Mode, t.PATIENT_PERCENTAGE, t.GUARANTOR1_PERCENTAGE, t.GUARANTOR2_PERCENTAGE, t.DISCOUNT_PERCENTAGE, t.Document__, t.SUMFIELDS, t.DimFIELDS });

            // Properties
            this.Property(t => t.BILL__)
                .HasMaxLength(8);

            this.Property(t => t.Number)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.Reference)
                .HasMaxLength(20);

            this.Property(t => t.PATIENT)
                .HasMaxLength(80);

            this.Property(t => t.Arabic_Name)
                .HasMaxLength(30);

            this.Property(t => t.CASE__)
                .HasMaxLength(15);

            this.Property(t => t.Type)
                .HasMaxLength(7);

            this.Property(t => t.DOCTOR_NAME)
                .HasMaxLength(50);

            this.Property(t => t.Document_type)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.Bill_type)
                .IsRequired()
                .HasMaxLength(18);

            this.Property(t => t.Patient_type)
                .IsRequired()
                .HasMaxLength(11);

            this.Property(t => t.Voucher)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.PATIENT_ID)
                .HasMaxLength(6);

            this.Property(t => t.Mode)
                .IsRequired()
                .HasMaxLength(6);

            this.Property(t => t.Batch)
                .HasMaxLength(10);

            this.Property(t => t.GUARANTOR_1)
                .HasMaxLength(60);

            this.Property(t => t.GUARANTOR_2)
                .HasMaxLength(60);

            this.Property(t => t.Document__)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.ADMISION_ID)
                .HasMaxLength(10);

            this.Property(t => t.GUARANTOR1_ID)
                .HasMaxLength(6);

            this.Property(t => t.GUARANTOR2_ID)
                .HasMaxLength(6);

            this.Property(t => t.PATIENT_PRICE_LIST)
                .HasMaxLength(50);

            this.Property(t => t.GUARANTOR1_PRICE_LIST)
                .HasMaxLength(50);

            this.Property(t => t.GUARANTOR2_PRICE_LIST)
                .HasMaxLength(50);

            this.Property(t => t.GUARANTOR1_COVERAGE_PLAN)
                .HasMaxLength(50);

            this.Property(t => t.GUARANTOR2_COVERAGE_PLAN)
                .HasMaxLength(50);

            this.Property(t => t.PATIENT_HARDCODED)
                .HasMaxLength(5);

            this.Property(t => t.GUARANTOR1_HARDCODED)
                .HasMaxLength(5);

            this.Property(t => t.GUARANTOR2_HARDCODED)
                .HasMaxLength(5);

            this.Property(t => t.GUARANTOR2_REST)
                .HasMaxLength(5);

            this.Property(t => t.SUMFIELDS)
                .IsRequired()
                .HasMaxLength(260);

            this.Property(t => t.DimFIELDS)
                .IsRequired()
                .HasMaxLength(37);

            // Table & Column Mappings
            this.ToTable("ARC_SO_BillHEADER");
            this.Property(t => t.BILL__).HasColumnName("BILL_#");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.Reference).HasColumnName("Reference");
            this.Property(t => t.PATIENT).HasColumnName("PATIENT");
            this.Property(t => t.Arabic_Name).HasColumnName("Arabic_Name");
            this.Property(t => t.CASE__).HasColumnName("CASE_#");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.DOCTOR_NAME).HasColumnName("DOCTOR_NAME");
            this.Property(t => t.Document_type).HasColumnName("Document_type");
            this.Property(t => t.Bill_type).HasColumnName("Bill_type");
            this.Property(t => t.Patient_type).HasColumnName("Patient_type");
            this.Property(t => t.Voucher).HasColumnName("Voucher");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.closed).HasColumnName("closed");
            this.Property(t => t.PATIENT_ID).HasColumnName("PATIENT_ID");
            this.Property(t => t.Mode).HasColumnName("Mode");
            this.Property(t => t.Batch).HasColumnName("Batch");
            this.Property(t => t.Medical_Audit).HasColumnName("Medical_Audit");
            this.Property(t => t.Financial_Audit).HasColumnName("Financial_Audit");
            this.Property(t => t.GUARANTOR_1).HasColumnName("GUARANTOR_1");
            this.Property(t => t.GUARANTOR_2).HasColumnName("GUARANTOR_2");
            this.Property(t => t.PATIENT_PERCENTAGE).HasColumnName("PATIENT_PERCENTAGE");
            this.Property(t => t.GUARANTOR1_PERCENTAGE).HasColumnName("GUARANTOR1_PERCENTAGE");
            this.Property(t => t.GUARANTOR2_PERCENTAGE).HasColumnName("GUARANTOR2_PERCENTAGE");
            this.Property(t => t.DISCOUNT_PERCENTAGE).HasColumnName("DISCOUNT_PERCENTAGE");
            this.Property(t => t.Document__).HasColumnName("Document_#");
            this.Property(t => t.ADMISION_ID).HasColumnName("ADMISION_ID");
            this.Property(t => t.TOTAL_AMOUNT_Base_1).HasColumnName("TOTAL_AMOUNT_Base_1");
            this.Property(t => t.TOTAL_AMOUNT_Base_2).HasColumnName("TOTAL_AMOUNT_Base_2");
            this.Property(t => t.PATIENT_AMOUNT_Base_1).HasColumnName("PATIENT_AMOUNT_Base_1");
            this.Property(t => t.PATIENT_AMOUNT_Base_2).HasColumnName("PATIENT_AMOUNT_Base_2");
            this.Property(t => t.GUARANTOR_1_AMOUNT_Base_1).HasColumnName("GUARANTOR_1_AMOUNT_Base_1");
            this.Property(t => t.GUARANTOR_1_AMOUNT_Base_2).HasColumnName("GUARANTOR_1_AMOUNT_Base_2");
            this.Property(t => t.GUARANTOR_2_AMOUNT_Base_1).HasColumnName("GUARANTOR_2_AMOUNT_Base_1");
            this.Property(t => t.GUARANTOR_2_AMOUNT_Base_2).HasColumnName("GUARANTOR_2_AMOUNT_Base_2");
            this.Property(t => t.Discount_amount_Base_1).HasColumnName("Discount_amount_Base_1");
            this.Property(t => t.Discount_amount_Base_2).HasColumnName("Discount_amount_Base_2");
            this.Property(t => t.GUARANTOR1_ID).HasColumnName("GUARANTOR1_ID");
            this.Property(t => t.GUARANTOR2_ID).HasColumnName("GUARANTOR2_ID");
            this.Property(t => t.PATIENT_PRICE_LIST).HasColumnName("PATIENT_PRICE_LIST");
            this.Property(t => t.GUARANTOR1_PRICE_LIST).HasColumnName("GUARANTOR1_PRICE_LIST");
            this.Property(t => t.GUARANTOR2_PRICE_LIST).HasColumnName("GUARANTOR2_PRICE_LIST");
            this.Property(t => t.GUARANTOR1_COVERAGE_PLAN).HasColumnName("GUARANTOR1_COVERAGE_PLAN");
            this.Property(t => t.GUARANTOR2_COVERAGE_PLAN).HasColumnName("GUARANTOR2_COVERAGE_PLAN");
            this.Property(t => t.PATIENT_HARDCODED).HasColumnName("PATIENT_HARDCODED");
            this.Property(t => t.GUARANTOR1_HARDCODED).HasColumnName("GUARANTOR1_HARDCODED");
            this.Property(t => t.GUARANTOR2_HARDCODED).HasColumnName("GUARANTOR2_HARDCODED");
            this.Property(t => t.GUARANTOR2_REST).HasColumnName("GUARANTOR2_REST");
            this.Property(t => t.SUMFIELDS).HasColumnName("SUMFIELDS");
            this.Property(t => t.DimFIELDS).HasColumnName("DimFIELDS");
        }
    }
}
